home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_2 / input.mod < prev    next >
Text File  |  1995-03-23  |  4KB  |  92 lines

  1. Article 4902 of comp.sys.handhelds:
  2. Newsgroups: comp.sys.handhelds
  3. Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!news.cs.indiana.edu!rsg1.er.usgs.gov!rsg1.er.usgs.gov!stevev
  4. From: stevev@greylady.uoregon.edu (Steve VanDevender)
  5. Subject: Re: HP48: putting it in alpha mode
  6. In-Reply-To: khbsnsr@nmt.edu's message of 7 Mar 91 11:50:16 GMT
  7. Message-ID: <STEVEV.91Mar9010755@greylady.uoregon.edu>
  8. Followup-To: comp.sys.handhelds
  9. Sender: news@rsg1.er.usgs.gov
  10. Organization: University of Oregon Chemistry Stores
  11. References: <9103061705.AA08584@uceng.UC.EDU> <1991Mar7.115016.9062@nmt.edu>
  12. Date: 9 Mar 91 01:07:55
  13.  
  14. Admittedly, the HP-48 manuals are OK tutorials but horrible
  15. reference manuals.  However, the INPUT command is fairly well
  16. documented in volume II on pages 526-528.  To summarize, the
  17. level 2 argument to INPUT is the prompt string, and the argument
  18. in level 1 determines the initial command line you can edit and
  19. the input state.  If the level 1 argument is a string, then that
  20. string is placed in the command line for editing with the cursor
  21. at the end.  The level 1 argument can also be a list containing
  22. any of the following three types of objects in any order:
  23.  
  24. 1.  An initial command line string.
  25.  
  26. 2.  The cursor position, either as a real number specifying the
  27. character position in the given command line string or a list of
  28. two reals, where the first specifies the line and the second the
  29. column in the command string.  A negative single real or a
  30. negative row number in the list tells INPUT to use the replace
  31. cursor instead of the insert cursor.  A real 0 specifies the end
  32. of the command string or the end of a line in the command string.
  33.  
  34. 3.  Any of three unquoted global names specifying special input modes:
  35.  
  36. ALG for algebraic program entry mode
  37. \Ga (Greek alpha) for alpha entry mode
  38. V to check the command line for proper syntax; it must parse to
  39. one or more valid objects.
  40.  
  41. I use INPUT as the basis of a simple text editing and storage
  42. application, with a simple custom menu and small program, and use
  43. INPUT with alpha entry mode in a string search function.  Here
  44. is the custom menu and the program:
  45.  
  46. 'CST':
  47.  
  48. {
  49.   { "EDIT" \<< 0 EDIT \>> }
  50.   { "FIND" \<< DUP "Find:" { \Ga \} INPUT POS EDIT \>> }
  51. }
  52.  
  53. 'EDIT':
  54.  
  55. \<<
  56.   IF DEPTH 2 \>=
  57.   THEN
  58.     2 \->LIST "" SWAP 28 MENU INPUT 2 MENU
  59.   END
  60. \>>
  61.  
  62. I have these together in a subdirectory along with another
  63. directory, FILES, which contains a bunch of string variables.  To
  64. examine a string, I cd to FILES, recall one of the strings, then
  65. press CST and EDIT.  To search for a substring in a string, I
  66. recall a string, press CST and FIND, then enter the substring to
  67. search for.  FIND then brings up the string in INPUT with the
  68. cursor positioned on the first character of the found string.  If
  69. I want to save the changes after editing a string, I get back to
  70. the VAR menu and store the modified string back in the variable I
  71. got it from.
  72.  
  73. Since INPUT basically gives you access to the full text-editing
  74. mode built in to the 48, it's almost the perfect solution.  Man,
  75. I love this machine :-).  All I could ask for is cut-and-paste
  76. editing in INPUT mode, but that would probably require some more
  77. complex programming.  Pasting is easy since you can go into the
  78. interactive stack and ECHO in strings already on the stack, but
  79. the only solution I can think of for a cut function is to put
  80. special begin and end marker characters in the string and write a
  81. program to find them and do a SUB to extract the substring
  82. between them.
  83.  
  84.  
  85. --
  86. Steve VanDevender     stevev@greylady.uoregon.edu
  87. "Bipedalism--an unrecognized disease affecting over 99% of the population.
  88. Symptoms include lack of traffic sense, slow rate of travel, and the
  89. classic, easily recognized behavior known as walking."
  90.  
  91.  
  92.